<template>
  <div class="cover">
    <div class="keyDetail-title">
      <div class="keyDetail-title-flex">
        <a @click="$router.goBack()">返回</a>
        <div><span @click="keywordModel">马云<i></i></span></div>
        <p>修改</p>
      </div>
    </div>
    <div class="keyDetail-nav">
      <div class="nav-bar">
        <mt-button
          v-for="(item,index) in tabList"
          size="small"
          @click.native.prevent="activeChange(item.id,index)"
          :key="index"
          :class="{'current-selected':index==presentIndex}">{{ item.name }}</mt-button>
      </div>
    </div>
    <div class="page-tab-container">
      <mt-tab-container class="page-tabbar-tab-container" v-model="active" swipeable="swipeable">
        <mt-tab-container-item id="info">
          <keyword-information :boxStatus="popupVisible"></keyword-information>
        </mt-tab-container-item>
        <mt-tab-container-item id="chart">
          <div class="ceshi">222</div>
        </mt-tab-container-item>
        <mt-tab-container-item id="warn">
          <div class="ceshi">333</div>
        </mt-tab-container-item>
        <mt-tab-container-item id="daily">
          <div class="ceshi">4444</div>
        </mt-tab-container-item>
      </mt-tab-container>
    </div>
    <div class="go-home" @click="$router.push('/home')"></div>
    <mt-popup
      v-model="popupVisible"
      position="top">
      <div class="new-plan-top">
        <div class="plan-top-name">
          <span class="bold">马云</span>
          <i></i>
        </div>
        <div class="plan-top-info">
          <div class="p-t-left">
            <span>关键词：马云</span>
            <p>排除词：未设置</p>
          </div>
          <div class="p-t-right" @click="deleteKeyword"></div>
        </div>
      </div>
    </mt-popup>
    <mt-popup
      v-model="popupVisible"
      position="bottom">
      <div class="new-plan-bottom">
        <span><i></i>新建方案</span>
      </div>
    </mt-popup>
  </div>
</template>

<script>
  import {MessageBox} from 'mint-ui'
  import keywordInformation from '../keywordData/keywordInformation'
  export default {
    name: "keywordDetail",
    data() {
      return {
        popupVisible:false,
        active: 'info',
        presentIndex:0,
        tabList:[{
          id:'info',
          name:'信息列表'
        },{
          id:'chart',
          name:'图表'
        },{
          id:'warn',
          name:'预警'
        },{
          id:'daily',
          name:'日报'
        }]
      }
    },
    methods:{
      activeChange(val,index){
        // console.log(index);
        this.active = val;
        this.presentIndex = index
      },
      keywordModel(){
        this.popupVisible = true;
      },
      deleteKeyword(){
        let that = this;
        that.popupVisible = false;
        MessageBox.confirm('确定取消监测吗？', '提示').then(action => {
          if (action == 'confirm') {
            that.$router.push('/monitorList')
          }
        }).catch(error => {
          if (error == 'cancel') {
            this.popupVisible = true;
            return false
          }
        });
      }
    },
    components:{
      keywordInformation
    },
    watch:{
      'active':function (newValue) {
        switch (newValue) {
          case 'info':
            this.presentIndex = 0;
            break;
          case 'chart':
            this.presentIndex = 1;
            break;
          case 'warn':
            this.presentIndex = 2;
            break;
          case 'daily':
            this.presentIndex = 3;
            break;
        }
      }
    }
  }
</script>

<style scoped lang="less">

  .keyDetail-title {
    position: fixed;
    top: 0;
    margin: auto;
    width: 750px;
    height: 88px;
    background-color: #05469b;
    z-index: 2000;
    .keyDetail-title-flex {
      width: 100%;
      height: 100%;
      display: flex;
      justify-content: space-between;
      align-items: center;
      color: #fff;
      font-size: 30px; /*px*/
      p {
        margin-right: 32px;
      }
      a {
        padding-left: 32px;
      }
      div {
        flex: 1;
        text-align: center;
        font-size: 34px; /*px*/
        i {
          display: inline-block;
          width: 36px;
          height: 30px;
          background: url("../../assets/monitor/list_bicon@2x.png") no-repeat center;
          background-size: 36px 30px;
          vertical-align: middle;
        }
      }
    }
  }

  .keyDetail-nav {
    width: 100%;
    margin-top: 88px;
    background-color: #fff;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(8, 41, 85, 0.08);
    .nav-bar {
      margin: 24px 15px 16px;
      height: 60px;
      background-color: #eee;
      border-radius: 88px;
      border: 1px solid #e5e5e4; /*no*/
      display: flex;
      justify-content: space-between;
      align-items: center;
      .mint-button--small {
        font-size: 28px; /*px*/
        width: 178px;
        height: 60px;
        line-height: 60px;
        background-color: #eee;
        box-shadow: none;
        padding: 0;
        border-radius: 0;
        color: #767676;
      }
      .current-selected{
        color: #fff;
        background-color: #05469b;
      }
      .mint-button--small:first-child {
        border-top-left-radius: 88px;
        border-bottom-left-radius: 88px;
      }
      .mint-button--small:last-child {
        border-top-right-radius: 88px;
        border-bottom-right-radius: 88px;
      }
      .mint-button--small + .mint-button--small {
        border-left: 1px solid #cdcdcd; /*no*/
      }
    }
  }
  .ceshi{
    width: 100%;
    height: 500px;
    background-color: #fff;
  }
  [data-dpr='3'] .keyDetail-title {
    .keyDetail-title-flex span i {
      background: url("../../assets/monitor/list_bicon@3x.png") no-repeat center;
      background-size: 36px 30px;
    }
  }

  .mint-popup{
    background-color: rgba(0, 0, 0, 0.01);
  }
  .new-plan-top{
    width: 686px;
    height: 262px;
    background-color: #fff;
    border-radius: 8px;
    margin-top: 118px;
    .plan-top-name{
      width: 100%;
      height: 96px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 36px;/*px*/
      color: #05469b;
      border-bottom: 2px solid #e6ebf1;/*px*/
      span{
        padding-left: 30px;
      }
      i{
        display: block;
        width: 36px;
        height: 35px;
        background: url("../../assets/monitor/list_sure@2x.png") no-repeat center;
        background-size: 36px 35px;
        margin-right: 30px;
      }
    }
    .plan-top-info{
      width: 100%;
      height: 164px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      .p-t-left{
        margin-left: 30px;
        font-size: 30px;/*px*/
        color: #666;
        font-weight: 400;
        p{
          margin-top: 20px;
        }
      }
      .p-t-right{
        width: 36px;
        height: 36px;
        background: url("../../assets/monitor/list_delet@2x.png") no-repeat center;
        background-size: 36px 36px;
        margin-right: 30px;
      }
    }
  }
  .new-plan-bottom{
    width: 686px;
    height: 80px;
    background-color: #fff;
    margin-bottom: 58px;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 32px;/*px*/
    font-weight: 400;
    color: #3f7bff;
    i{
      display: inline-block;
      width: 48px;
      height: 32px;
      background: url("../../assets/monitor/list_new@2x.png") no-repeat center;
      background-size: 48px 32px;
      vertical-align: middle;
      margin-bottom: 8px;
    }
  }
  [data-dpr='3'] .new-plan-top{
    .plan-top-name i{
      background: url("../../assets/monitor/list_sure@3x.png") no-repeat center;
      background-size: 36px 35px;
    }
    .plan-top-info .p-t-right{
      background: url("../../assets/monitor/list_delet@3x.png") no-repeat center;
      background-size: 36px 36px;
    }
  }
  [data-dpr='3'] .new-plan-bottom i{
    background: url("../../assets/monitor/list_new@3x.png") no-repeat center;
    background-size: 48px 32px;
  }
</style>
